Basic Concepts
The more information the analyzer knows about the compilation environment of a file, the more accurate and consistent results will be. As an example, take the following piece of C code:
This is compiled with the following command:
Looking at file.c, we can see that there are several identifiers that are not resolved within that file itself: foo
, i
, MACRO
and CLIMACRO
. This poses a question for any designer of a static analyzer or compiler:
- What to do when an identifier is not resolved in the source file within which it was declared or used.
How this question is answered determines the robustness of analysis results. The primary analysis components do not simply assume that identifiers and language constructs correctly resolve to something safe and legal: Helix QAC parsers resolve identifiers and determine the resolved values.
For this reason, the analysis components need to know the information that your compiler knows about your source files when they are compiled. This includes compiler specifics, such as:
- the compiler’s built-in extensions to the language,
- the location of compiler include directories or references,
- the sizes of the various types known to your compiler,
and also build environment information, such as:
- the search paths that are used when compiling your source files to locate include files or references,
- environment variables that are present when compiling your source files,
- macros that are passed to your compiler on the command line while compiling.
This amounts to a great deal of data, data that may change from project to project, subproject to sub-project or, indeed, source file to source file. Fortunately, Helix QAC is equipped with features that automate the extraction of this data.
As the information that accompanies a source file when being compiled is intrinsic to the resolution of all, not some, types and identifiers, Helix QAC has not been designed as a tool that leads the user to simply point to a source file and expect coherent analysis results. The apparent complication of the setup process is the price to pay in order to have insightful and complete diagnostic data as an outcome from the analysis results.
Creating a Helix QAC Project will guide you through creating your first Helix QAC project. Extraction of Configuration Data describes the various data extraction features that are available so that you may choose one that suits your environment. Analyzing Your Project provides instructions on the various ways in which you can analyze your new project.